package com.ganmiao.server.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ganmiao.server.sys.validated.Add;
import com.ganmiao.server.sys.validated.Delete;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 用户角色信息
 *
 * @TableName sys_user_role
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("用户角色信息")
@TableName(value = "sys_user_role")
public class SysUserRole implements Serializable {

    /**
     * 用户角色主键ID
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("用户角色主键ID")
    private Integer userRoleId;

    /**
     * 用户ID
     */
    @NotNull(groups = Delete.class, message = "用户ID不能为空")
    @ApiModelProperty("用户ID")
    private Integer userId;

    /**
     * 角色ID
     */
    @NotNull(groups = {Add.class, Delete.class}, message = "角色ID不能为空")
    @ApiModelProperty("角色ID")
    private Integer roleId;

    /**
     * 状态 (1:正常 9:删除/失效)
     */
    @ApiModelProperty("状态 (1:正常 9:删除/失效)")
    private String status;

    /**
     * 用户ID集合
     */
    @TableField(exist = false)
    @NotEmpty(groups = Add.class, message = "用户ID集合不能为空")
    @ApiModelProperty("用户ID集合")
    private List<Integer> userIds;

}